package n1050;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {

	
	static int arr[][]=new int[101][101];
	
	
	static int sum[][]=new int[101][101];
	
	static int N;
	
	static void init()
	{
		for(int i=0;i<=N;i++){
			sum[0][i]=0;
			sum[i][0]=0;
		}
		for(int i=1;i<=N;i++)
			for(int j=1;j<=N;j++)
			{
				sum[i][j]=sum[i-1][j]+sum[i][j-1]-sum[i-1][j-1]+arr[i-1][j-1];
			}
	}
	
	static int solve()
	{
		int max=Integer.MIN_VALUE;
		
		
		for(int i=1;i<=N;i++)
			for(int j=i;j<=N;j++)
			{
				int curmax=sum[j][1]-sum[i-1][1];
				int tmp=curmax;
				for(int k=2;k<=N;k++)
				{
					int cur=sum[j][k]-sum[j][k-1]-sum[i-1][k]+sum[i-1][k-1];
					if(tmp<=0)tmp=cur;
					else tmp+=cur;
					if(tmp>curmax)curmax=tmp;
				}
				if(curmax>max)max=curmax;
			}
		return max;
	}
	
	/**
	 * @param args
	 */
	public static void main(String[] args) throws Exception{

		Scanner cin=new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		N=cin.nextInt();
		for(int i=0;i<N;i++)
			for(int j=0;j<N;j++)
				arr[i][j]=cin.nextInt();
		init();
		System.out.println(solve());
	}

}
